<?php

namespace addons\Flow\common\models;

use Yii;

/**
 * This is the model class for table "{{%addon_flow_study}}".
 *
 * @property int $id 编号
 * @property int $cate_id 分类
 * @property string $title 标题
 * @property string $content 内容
 * @property int $status 状态
 * @property int $created_at 创建时间
 * @property int $updated_at 更新时间
 */
class Works extends \common\models\base\BaseModel
{
    /**
     * {@inheritdoc}
     */
    public $mark;

    public static function tableName()
    {
        return '{{%addon_flow_works}}';
    }

    /**
     * {@inheritdoc}
     */
    public function rules()
    {
        return [
            [['content'], 'required'],
            [['member_id','audit_id','work_id','created_at','updated_at'], 'integer'],
            [['workflow_id','state'], 'string','max' => 32],
            [['content','mark'], 'string','max' => 255],
        ];
    }

    /**
     * {@inheritdoc}
     */
    public function attributeLabels()
    {
        return [
            'id' => '编号',
            'content' => '工作内容',
            'mark' => '重审原因',
            'member_id' => '申请用户',
            'audit_id' => '审核用户',
            'workflow_id' => '工作流ID',
            'work_id' => '工作ID',
            'state' => '工作流状态',
            'status' => '状态',
            'created_at' => '创建时间',
            'updated_at' => '更新时间',
        ];
    }

    /**
     * 关联申请用户
     *
     * @return \yii\db\ActiveQuery
     */
    public function getMember()
    {
        return $this->hasOne(\common\models\merchant\Member::class, ['id' => 'member_id']);
    }
    /**
     * 关联审核用户
     *
     * @return \yii\db\ActiveQuery
     */
    public function getAuditor()
    {
        return $this->hasOne(\common\models\merchant\Member::class, ['id' => 'audit_id']);
    }

}
